<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_report" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left">
          {{s_report.description}}
        </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="类型" prop="">
              {{getValueName("列表=list,柱状图=bar,线状图=line,饼状图=pie,",s_report.type)}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="数据" prop="">
              {{s_report.sql_id}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="gotoPage('/mes/systemadmin/ReportUpdate?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改</el-button>
      <el-button @click="gotoPage('/mes/systemadmin/ReportAdd?'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加参数</el-button>
      <el-button @click="gotoPage('/mes/systemadmin/ReportData?'+vueparams+'')" type='primary' size="mini">绑定数据</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 报表参数 </span>
      </div>
      <el-table :data="s_params">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="d_params('&param_id='+scope.row.param_id+'')">删除</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="参数" prop="name" class="formLabel">
        </el-table-column>
        <el-table-column label="参数值" prop="">
          <template slot-scope="scope">
            <el-input v-model="empty" />
          </template>
        </el-table-column>
        <el-table-column label="参数说明" prop="description">
        </el-table-column>
      </el-table>
      <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>搜索</el-button>
      <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>搜索</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 列表参数 </span>
      </div>
      <el-table :data="s_list">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="d_params('&param_id='+scope.row.param_id+'')">删除</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="参数" prop="name">
        </el-table-column>
        <el-table-column label="禁用" prop="disable">
          <template slot-scope="scope">
            {{getValueName("是=1",scope.row.disable)}}
          </template>
        </el-table-column>
        <el-table-column label="参数说明" prop="description">
        </el-table-column>
      </el-table>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ReportDetail',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_report: {
          type: null,
          sql_id: null,
        },
        s_params: [],
        s_list: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/systemadmin/ReportAdminAction/reportDetail?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_params(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/systemadmin/ReportAdminAction/d_params?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
